with v8.Class_Object, v8.Class_Value, v8.Class_String;
package v8.Class_Reg_Exp is
   type Reg_Exp (<>) is new v8.Class_Object.Object with private;
   type Pointer is access all Reg_Exp;
   -- An instance of the built-in RegExp constructor (ECMA-262, 15.10).


   function Create
     (pattern   : v8.Class_String.Pointer;
      the_flags : Reg_Exp_Flags.Enum
     ) return Pointer;
   -- Creates a regular expression from the given pattern string and
   -- the flags bit field. May throw a JavaScript exception as
   -- described in ECMA-262, 15.10.4.1.
   --
   -- For example,
   --   RegExp::New(v8::String::New("foo"),
   --               static_cast<RegExp::Flags>(kGlobal | kMultiline))
   -- is equivalent to evaluating "/foo/gm".

   function Get_Source (this : Reg_Exp) return v8.Class_String.Pointer;
   -- Returns the value of the source property: a string representing
   -- the regular expression.

   function Get_Flags (this : Reg_Exp) return Reg_Exp_Flags.Enum;
   -- Returns the flags bit field.


   function Cast is new Ada.Unchecked_Conversion (v8.Class_Value.Pointer, Pointer);
   -- Convert Value to RegExp

private
   type Reg_Exp is new v8.Class_Object.Object with null record;

   pragma Import (CPP, Create, "_ZN2v86RegExp3NewENS_6HandleINS_6StringEEENS0_5FlagsE");
   pragma Import (CPP, Get_Source, "_ZNK2v86RegExp9GetSourceEv");
   pragma Import (CPP, Get_Flags, "_ZNK2v86RegExp8GetFlagsEv");
end v8.Class_Reg_Exp;
